﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ExchangeGoods.aspx.cs" Inherits="Web.User.Exchange.ExchangeGoods" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title></title>
    <script src="../../Scripts/jquery-1.4.1-vsdoc.js" type="text/javascript"></script>
    <script src="../../Scripts/jquery-1.4.1.js" type="text/javascript"></script>
    <script src="../../Scripts/WebInner.js" type="text/javascript"></script>
    <script src="../../Scripts/Common.js" type="text/javascript"></script>
    <link href="../../Styles/Common.css" rel="stylesheet" type="text/css" />
    <script src="../../Scripts/Zebra/zebra_dialog.js" type="text/javascript"></script>
    <link href="../../Scripts/Zebra/zebra_dialog.css" rel="stylesheet" type="text/css" />
    <script src="../../Lodop6.198/LodopFuncs.js" type="text/javascript"></script>
      <script type="text/javascript">
          /*--------窗体启动设置和基本设置--------*/
          /*--loadFuntion--*/
          var ChuFenLv = 0; //出粉率
          var limitMount = 0; //营业员操作限额
          $(function () {

              //查询当前的营业员信息和存储信息
              var Dep_SID = getQueryString("Dep_SID");
              if (Dep_SID != "") {
                  $('input[name=txtDep_SID]').val(Dep_SID);
                  $('#Exchange').fadeIn('normal'); //显示兑换信息选择项
                  //查找当前选择的存储信息
                  InitStorageInfo(Dep_SID);
                  //加载当前的储户信息
                  InitDepositor(Dep_SID);
              }
              //加载商品
              Get_Good();
              $('select[name=GoodID]').change(function () { //选择兑换商品
                  //获取商品规格
                  ShowGoodUnit();
                  GetGoodStorage();
              });
              $('#btnChongLai').click(function () {
                  window.location = '/User/Exchange/ExchangeGoods.aspx'; //重新刷新该页面
              });

              GetUserLimit();//获取营业员操作限额
          });

          function GetUserLimit() {
              //查看当前营业员的限额是否足够
              $.ajax({
                  url: '/Ashx/wbinfo.ashx?type=GetUserLimit',
                  type: 'post',
                  data: '',
                  dataType: 'text',
                  success: function (r) {
                      limitMount = parseInt(r);
                  }, error: function (r) {
                      $.Zebra_Dialog('<strong>获取当前营业员的操作限额时发生错误 ！</strong>');
                  }
              });
          }

        

          //初始化存储信息
          function InitStorageInfo(Dep_SID) {
              $.ajax({
                  url: '/User/Exchange/exchange.ashx?type=GetStorageInfoByID&ID=' + Dep_SID,
                  type: 'post',
                  data: '',
                  dataType: 'json',
                  success: function (r) {
                      $('#StorageList').hide();
                      $('#Storage').show();
                      $('#depositorInfo').show();
                      $('#VarietyID').html(r[0].VarietyID);
                      $('#S_ChanPin').html(r[0].VatietyID);
                      $('#S_ChanPin2').html(r[0].VatietyID);
                      $('#StorageNumber').html(r[0].StorageNumber);
                      $('input[name=txtJieCun_Now]').val(r[0].StorageNumber); //初始化产品结存数量
                      $('input[name=txtJieCun_Raw]').val(r[0].StorageNumber); //初始化产品结存数量
                      $('#StorageDate').html(r[0].StorageDate);
                      $('#Price_ShiChang').html(r[0].Price_ShiChang);
                      $('input[name=txtVarietyPrice]').val(r[0].Price_ShiChang);
                      $('input[name=txtVarietyName]').val(r[0].VarietyID);
                      $('#TimeID').html(r[0].TimeID);
                      $('#numDate').html(r[0].numDate);

                      $('input[name=txtVarietyID]').val(r[0].txtVarietyID);
                      $('input[name=txtTimeID]').val(r[0].txtTimeID);
                      $('input[name=txtVarietyUnitName]').val(r[0].UnitID);

                  }, error: function (r) {
                      $.Zebra_Dialog('<strong>加载储户存储信息失败 ！</strong>');
                  }
              });
          }
          //初始化储户信息
          function InitDepositor(Dep_SID) {
              $.ajax({
                  url: '/User/Exchange/exchange.ashx?type=GetDepInfoByStorageID&ID=' + Dep_SID,
                  type: 'post',
                  data: '',
                  dataType: 'json',
                  success: function (r) {
                      $('#StorageList').hide();
                      $('#Storage').show();
                      $('#depositorInfo').show();
                      $('#QAccountNumber').val(r[0].AccountNumber);

                      $('#D_AccountNumber').html(r[0].AccountNumber);
                      $('#D_strName').html(r[0].strName);
                      $('#D_PhoneNo').html(r[0].PhoneNO);
                      $('#D_strAddress').html(r[0].strAddress);
                      $('#D_numState').html(r[0].numState);
                      $('#D_IDCard').html(r[0].IDCard);

                  }, error: function (r) {
                      $.Zebra_Dialog('<strong>加载储户存储信息失败 ！</strong>');
                  }
              });
          }


          //获取选择的商品信息
          function Get_Good() {
              var strUrl = '/Ashx/good.ashx?type=Get_Good&strName=' + $('input[name=txtGoodQuery]').val();
              $.ajax({
                  url: strUrl,
                  type: 'post',
                  data: '',
                  dataType: 'json',
                  success: function (r) {
                      $('select[name=GoodID]').empty();
                      for (var i = 0; i < r.length; i++) {
                          $('select[name=GoodID]').append("<option value='" + r[i].ID + "'>" + r[i].strName + "</option>");
                      }
                      ShowGoodUnit();
                      GetGoodStorage();
                  
                  }, error: function (r) {
                     // $.Zebra_Dialog('<strong>加载商品信息失败 ！</strong>');
                  }
              });
          }

          function ShowGoodUnit() {
              var GoodID = $('select[name=GoodID] option:selected').val();
              $.ajax({
                  url: '/Ashx/good.ashx?type=ShowExchangeUnitByGoodID&ID=' + GoodID,
                  type: 'post',
                  data: '',
                  dataType: 'json',
                  success: function (r) {

                      $('input[name=txtGoodPrice]').val(r[0].Price_DuiHuan); //保存商品价格信息

                  }, error: function (r) {
                      $.Zebra_Dialog('<strong>加载商品兑换价格失败 ！</strong>');
                  }
              });
          }
          //获取产品库存
          function GetGoodStorage() {
              var GoodID = $('select[name=GoodID] option:selected').val();
              $.ajax({
                  url: '/Ashx/storage.ashx?type=GetGoodStorageByGoodID&GoodID=' + GoodID,
                  type: 'post',
                  data: '',
                  dataType: 'json',
                  success: function (r) {
                      $('#GoodStorage').html(r[0].numStore);
                  }, error: function (r) {
                      $('#GoodStorage').html('0');
                  }
              });
          }

          //查询当前商品在系统中是否存在兑换比率
          function GetChuFenLv() {
              //var GoodCount = parseInt($('input[name=ExchangeCount]').val()); //商品数量
              //var GoodCount = $('input[name=ExchangeCount]').val();
              //var regex = /^[1-9]+[0-9]*]*$/;
              //if (!regex.test(GoodCount)) {
              //    $.Zebra_Dialog('<strong>兑换数量请输入整数 ！</strong>');
              //    return false;
              //} else {
              //    GoodCount = parseInt(GoodCount);
              //}

              var GoodCount = $('input[name=ExchangeCount]').val();
            
              if (isNaN(GoodCount)) {
                  $.Zebra_Dialog('<strong>兑换数量请输入数字 ！</strong>');
                  return false;
              } else {
                  GoodCount = parseInt(GoodCount);
              }
             
              var paraTimeID = $('input[name=txtTimeID]').val(); //已选择的存期类型
              var VarietyID = $('input[name=txtVarietyID]').val(); //已选择的产品类型
              var GoodID = $('select[name=GoodID] option:selected').val(); //已选择的商品类型
              $.ajax({
                  url: '/Ashx/exchangeprop.ashx?type=GetExchangePropByID&TimeID=' + paraTimeID + "&VarietyID=" + VarietyID + "&GoodID=" + GoodID,
                  type: 'post',
                  data: '',
                  dataType: 'json',
                  success: function (r) {
                      ChuFenLv = parseFloat(r[0].ChuFenLv);
                      //按照比例兑换
                      $('#divPolicy').fadeIn("normal");
                      $('#spanPolicy').html('');
                      var TimeName = $('#TimeID').html(); //已选择的存期类型
                      var VarietyName = $('#VarietyID').html(); //已选择的产品类型
                      var GoodName = $('select[name=GoodID] option:selected').text(); //已选择的商品类型
                      var strMsg = "按比例兑换;存期类型:" + TimeName + ",产品类型:" + VarietyName + ",商品类型:" + GoodName + ",出粉率:" + ChuFenLv;
                   
                      $('#spanPolicy').html(strMsg);
                      AddExchange();
                  }, error: function (r) {
                      ChuFenLv = 0;
                      AddExchange();
                  }
              });
          }
          /*--ENd loadFuntion--*/

          //添加兑换商品信息
          function AddExchange() {
              //是否存在储户账号
              if ($('#D_AccountNumber').html() == '') {
                  $.Zebra_Dialog('<strong>请选择存储账户 ！</strong>');
                  return false;
              }
              if ($('#VarietyID').html() == '') {
                  $.Zebra_Dialog('<strong>请选择存储产品 ！</strong>');
                  return false;
              }
       

              //计算折合原粮和收费
              var GoodPrice = parseFloat($('input[name=txtGoodPrice]').val()); //商品价格
              // var GoodCount = parseInt($('input[name=ExchangeCount]').val()); //商品数量
              var GoodCount = parseFloat($('input[name=ExchangeCount]').val()); //商品数量
              var JinE = accMul(GoodPrice, GoodCount); //商品价值金额
              $('input[name=txtGoodPrice]').val(GoodPrice); //兑换产品数量
              $('input[name=txtGoodCount]').val(GoodCount); //兑换产品数量
              $('input[name=txtGoodJinE]').val(JinE); //兑换产品数量

              if (limitMount < parseFloat(JinE)) {//大于当前营业员的操作限额
                  $.Zebra_Dialog('<strong>当前产品的兑换金额已经大于营业员的兑换限额 ！</strong>');
                  ExchangeEnd();
                  return false;
              }
              var VarietyPrice = parseFloat($('#Price_ShiChang').html()); //存储产品价格
              var VarietyCount;//需要的产品数量

              //查询当前仓库中的商品存储数量是否足够
              var StorageCount = $('#GoodStorage').html(); ; //仓库库存
              if (parseFloat(StorageCount) < parseFloat(GoodCount)) {//判断仓库库存是否足够
                  $.Zebra_Dialog('<strong>仓库中的商品数量已不足，进货后方可兑换该商品 ！</strong>');
                  ExchangeEnd();
                  return false;
              }
          
              if (ChuFenLv == "0") {//获取按照价格兑换时候的原粮数量
                  $.ajax({
                      url: '/Ashx/exchangeprop.ashx?type=GetExchangeVarietyCount&Dep_SID=' + $('input[name=txtDep_SID]').val() + '&numMoney=' + JinE + '&Exchange_trading=' + $('input[name=txtExchange_trading]').val(),
                      type: 'post',
                      data: '',
                      dataType: 'json',
                      success: function (r) {
                     
                          VarietyCount = parseFloat(r.VarietyCount);
                          var strPolicy = r.strPolicy;
                          $('#divPolicy').fadeIn("normal");
                          $('#spanPolicy').html(strPolicy);
                          $('input[name=txtVarietyCount]').val(VarietyCount); //当次兑换产品的数量

                          var JieCun_Now = $('input[name=txtJieCun_Now]').val(); //产品当前的结存数量
                          if (VarietyCount > JieCun_Now) {
                              $.Zebra_Dialog('<strong>储户的存储产品结存不足，无法完成兑换！</strong>');
                              ExchangeEnd();
                              return false;
                          } else {
                              //更新结存

                              JieCun_Now = parseFloat(JieCun_Now) - parseFloat(VarietyCount);
                              $('input[name=txtJieCun_Now]').val(JieCun_Now);
                              ShowExChangeInfo();
                          }
                      }, error: function (r) {
                          $.Zebra_Dialog('<strong>获取折合原粮数量时发生错误 ！</strong>');
                          ExchangeEnd();
                          return false;
                      }
                  });

              }
              else {
                  VarietyCount = accDiv(GoodCount, ChuFenLv); //按照比例兑换
                  $('input[name=txtVarietyCount]').val(VarietyCount); //当次兑换产品的数量
                  var JieCun_Now = $('input[name=txtJieCun_Now]').val(); //产品当前的结存数量
                  if (VarietyCount > JieCun_Now) {
                      $.Zebra_Dialog('<strong>储户的存储产品结存不足，无法完成兑换！</strong>');
                      ExchangeEnd();
                      return false;
                  } else {
                      JieCun_Now = parseFloat(JieCun_Now) - parseFloat(VarietyCount);
                      $('input[name=txtJieCun_Now]').val(JieCun_Now);
                      ShowExChangeInfo();
                     
                  }
              }

             
          }


          function ShowExChangeInfo() {
              ExchangeActive();
              var GoodID = $('select[name=GoodID] option:selected').val(); //选择的商品ID
             
              $.ajax({
                  url: '/Ashx/exchangeprop.ashx?type=UpdateExChangeList&GoodID='+GoodID,
                  type: 'post',
                  data: $('#form1').serialize(),
                  dataType: 'text',
                  success: function (r) {
                      var msg = JSON.parse(r)
                      $('#ExchangeInfo').fadeIn("normal");
                      $('#ExchangeOperate').fadeIn("normal");
                      $('#ExchangeInfo').html('');
                      $('#ExchangeInfo').append(msg.exchangemsg);
                      $('input[name=txtExchange_trading]').val(msg.Total_VarietyCount);
                  }, error: function (r) {
                    
                      return false;
                  }
              });
          }

          //删除一条兑换记录
          function FunDelList(numIndex) {
              $.ajax({
                  url: '/Ashx/exchangeprop.ashx?type=DeleteExChangeList&numIndex=' + numIndex,
                  type: 'post',
                  data: $('#form1').serialize(),
                  dataType: 'json',
                  success: function (r) {
                      $('input[name=txtJieCun_Now]').val(r.JieCun_Now);
                      $('#ExchangeInfo').fadeIn("normal");
                      $('#ExchangeOperate').fadeIn("normal");
                      $('#ExchangeInfo').html('');
                      $('#ExchangeInfo').append(r.Msg);
                  }, error: function (r) {
                      $.Zebra_Dialog('<strong>取消失败 ！</strong>');
                      return false;
                  }
              });
          }
       
          //兑换条件不足，禁用兑换操作
          function ExchangeEnd() {
              $('#btnJieZhang').attr('disabled', 'disabled');
              $('#btnJieZhang').css("background", "#777");
          }
          //重启兑换操作
          function ExchangeActive() {
              $('#btnJieZhang').removeAttr('disabled');
              $('#btnJieZhang').css("background", "#cdc9a5");
          }

          function frmSubmit() {
              $.ajax({
                  url: '/Ashx/exchangeprop.ashx?type=Add_GoodExchange',
                  type: 'post',
                  data: $('#form1').serialize(),
                  dataType: 'text',
                  success: function (r) {
                      if (r == "Error") {
                          $.Zebra_Dialog('<strong>系统错误，请重新打开界面在进行兑换操作 ！</strong>');
                          return false;
                      } else {
                          $.Zebra_Dialog('<strong>兑换商品成功 ！</strong>');
                          $('#Query').fadeOut(); //隐藏查询按钮

                          $('#btnChongLai').attr('disabled', 'disabled');
                          $('#btnChongLai').css('background', '#aaa');
                          $('#btnJieZhang').attr('disabled', 'disabled');
                          $('#btnJieZhang').css('background', '#aaa');
                          $('#btnPrint').removeAttr('disabled');
                          $('#btnPrintPage').removeAttr('disabled');
                      }
                  }, error: function (r) {
                      $.Zebra_Dialog('<strong>兑换商品失败 ！</strong>');
                  }
              });
          }


          /*----打印----*/
          var p_left = 0; var p_ltop = 0; var p_lwidth = 0; var p_lheight = 0;
          $(function () {
              $.ajax({
                  url: '/Ashx/wbinfo.ashx?type=GetPrintSetting_Dep',
                  type: 'post',
                  data: '',
                  dataType: 'json',
                  success: function (r) {
                      p_lwidth = r[0].Width;
                      p_lheight = r[0].Height;
                      p_lleft = r[0].DriftRateX;
                      p_ltop = r[0].DriftRateY;
                  }, error: function (r) {
                      $.Zebra_Dialog('<strong>加载打印坐标时出现错误 ！</strong>');
                  }
              });
          });
          function CreateOneFormPage() {
              LODOP = getLodop();
              LODOP.PRINT_INIT("存折打印");
              LODOP.SET_PRINT_STYLE("FontSize", 18);
              LODOP.SET_PRINT_STYLE("Bold", 1);
              LODOP.ADD_PRINT_TEXT(0, 0, 0, 0, "打印页面部分内容"); 
              LODOP.ADD_PRINT_HTM(p_ltop, p_lleft, p_lwidth, p_lheight, document.getElementById("divPrint").innerHTML);

          };

          //加载新的业务编号
          function InitBusinessNO() {
              if (confirm('您确认已经认真检查完输入信息，并继续操作吗？')) {
                  $.ajax({
                      url: "/User/Storage/storage.ashx?type=GetNewBusinessNO&AccountNumber=" + $('#D_AccountNumber').html(),
                      type: 'post',
                      data: '',
                      dataType: 'text',
                      success: function (r) {
                          $('input[name=BusinessNO]').val(r);

                          frmSubmit();
                      }, error: function (r) {
                          $.Zebra_Dialog('<strong>加载信息失败 ！</strong>');
                      }
                  });
              }
          }

          function PrintCunZhe() {

              $.ajax({
                  url: '/Ashx/storage.ashx?type=PrintDep_OperateLogList&AccountNumber=' + $('#D_AccountNumber').html(),
                  type: 'post',
                  data: '',
                  dataType: 'json',
                  success: function (r) {
                      if (r.SurPlus != '') {
                          $('#btnPrintFanYe').fadeIn('normal');//显示可翻页打印
                      }
                      $('#divPrint').html('');
                      $('#divPrint').append(r.Msg);
                      CreateOneFormPage();
                      LODOP.PREVIEW(); //打印存折
                  }, error: function (r) {
                      $.Zebra_Dialog('<strong>加载打印坐标时出现错误 ！</strong>');
                  }
              });
          }


          function PrintCunZheFanYe() {

              $.ajax({
                  url: '/Ashx/storage.ashx?type=PrintDep_OperateLogList&AccountNumber=' + $('#D_AccountNumber').html() + '&Surplus=1',//添加翻页打印标识
                  type: 'post',
                  data: '',
                  dataType: 'json',
                  success: function (r) {
                      
                      $('#divPrint').html('');
                      $('#divPrint').append(r.Msg);
                      CreateOneFormPage();
                      LODOP.PREVIEW(); //打印存折
                  }, error: function (r) {
                      $.Zebra_Dialog('<strong>加载打印坐标时出现错误 ！</strong>');
                  }
              });
          }



          function PrintPage() {
              $.ajax({
                  url: '/Ashx/storage.ashx?type=PrintGoodExchangeList&AccountNumber=' + $('#D_AccountNumber').html(),
                  type: 'post',
                  data: '',
                  dataType: 'text',
                  success: function (r) {
                      $('#divPrintPaper').html('');
                      $('#divPrintPaper').append(r);
                      CreatePage();
                      LODOP.PREVIEW(); //打印存折
                  }, error: function (r) {
                      $.Zebra_Dialog('<strong>加载打印坐标时出现错误 ！</strong>');
                  }
              });

          }

          //小票打印
          function CreatePage() {
              LODOP = getLodop();
              LODOP.PRINT_INIT("小票打印");
              LODOP.SET_PRINT_STYLE("FontSize", 12);
              LODOP.SET_PRINT_STYLE("Bold", 1);
              LODOP.ADD_PRINT_TEXT(0, 0, 0, 0, "打印页面部分内容");

              LODOP.ADD_PRINT_HTM(20, 60, 800, 400, document.getElementById("divPrintPaper").innerHTML);

          };

          /*----End 打印----*/
      </script>
</head>
<body>
    <div id="divPrint" style="display:none">

    </div>
    <div id="divPrintPaper" style="display:none">

    </div>

    <form id="form1" runat="server">
    <div class="pageHead">
        <b>兑换商品</b><span id="spanHelp" style="cursor: pointer">帮助</span>
    </div>
    <div id="divHelp"  class="pageHelp">
<span>提示1：业务进行顺序：第一步：输入储户账号-->第二步：选择业务类型-->第三步：再选择交易商品-->第四步：输入数量-->添加，即完成一笔业务。
完成后，单击“结账”，完成商品兑换。</span><br />
<span>提示2：定期储粮兑换成品粮时，到期按到期价兑换，不到期按约定比例享受按到期价 优惠兑换 ，超过优惠额度则按存入价兑换；其它类型储户按约定计息（或不计息）兑换。</span><br />
<span>提示3：兑换时请注意兑换的计量单位与价格。</span><br />
</div>
<div id="storageQuery">

</div>
    <div style="margin: 20px 0px;">
    
        <div id="Query">
            <span>储户账号:</span>
            <input type="text" id="QAccountNumber" style="font-size:16px; font-weight:bolder;" runat="server" />
          &nbsp; <span>密码:</span>
            <input type="password" id="QPassword" style="font-size:12px;  width:100px;" runat="server" />
            <asp:ImageButton ID="ImageButton1" ImageUrl="~/images/seach_brown.png" 
                runat="server" onclick="ImageButton1_Click" />
        </div>
        <div id="depositorInfo" runat="server"  style="display:none;">
            <table class="tabData"  style="margin:20px 0px;">
                <tr >
                    <td colspan="6" style="border-bottom:1px solid #aaa; height:25px; text-align:center">
                        <span style="font-size: 16px; font-weight: bolder; color:Green">储户基本信息</span>
                    </td>
                </tr>
                <tr>
                    <th align="center" style="width:100px; height:30px;">
                        储户账号
                    </th>
                    <th align="center" style="width:100px;">
                        储户姓名
                    </th>
                     <th align="center" style="width:100px;">
                        移动电话
                    </th>
                      <th align="center" style="width:100px;">
                        当前状态
                    </th>
                      <th align="center" style="width:150px;">
                        身份证号
                    </th>
                     <th align="center" style="width:200px;">
                        储户地址
                    </th>
                   
                </tr>
                   <tr>
                  
                    <td style="height:30px;">
                        <span style="font-weight:bolder; color:Blue;" id="D_AccountNumber"   runat="server"></span>
                    </td>
                    
                    <td>
                        <span style="font-weight:bolder; color:Blue;" id="D_strName" runat="server"></span>
                    </td>
                    <td>
                        <span style="font-weight:bolder; color:Blue;" id="D_PhoneNo" runat="server"></span>
                    </td>
                     <td>
                        <span style="font-weight:bolder; color:Blue;" id="D_numState" runat="server"></span>
                    </td>
                      <td>
                        <span style="font-weight:bolder; color:Blue;" id="D_IDCard" runat="server"></span>
                    </td>
                    <td>
                        <span style="font-weight:bolder; color:Blue;" id="D_strAddress" runat="server"></span>
                    </td>
                </tr>
            </table>
        </div>
        <div id="StorageList" runat="server">
        <asp:Repeater ID="Repeater1" runat="server">
            <HeaderTemplate>
                <table class="tabData" >
                    <tr class="tr_head">
                        <th style="width: 100px; height:20px; text-align: center;">
                            存贷产品
                        </th>
                        <th style="width: 80px; text-align: center;">
                            结存数量
                        </th>
                        <th style="width: 100px; text-align: center;">
                            存入时间
                        </th>
                        <th style="width: 80px; text-align: center;">
                            存入价
                        </th>
                        <th style="width: 80px; text-align: center;">
                            存期
                        </th>
                        <th style="width: 80px; text-align: center;">
                            天数
                        </th>
                        <th style="width: 80px; text-align: center;">
                            活期利率
                        </th>
                        <th style="width: 100px; text-align: center;">
                            利息
                        </th>
                        <th style="width: 160px; text-align: center;">
                            结算类型
                        </th>
                    </tr>
            </HeaderTemplate>
            <ItemTemplate>
                <tr style='background-color: <%#(Container.ItemIndex%2==0)?"#FFFFF;":"#fcf3f4"%>'
                    onmouseover="change_colorOver(this)" onmouseout="change_colorOut(this)">
                    <td style="height:25px;">
                        <%#Eval("VarietyID")%>
                    </td>
                    <td>
                        <%#Eval("StorageNumber")%>
                    </td>
                    <td>
                        <%#Eval("StorageDate")%>
                    </td>
                    <td>
                        <%#Eval("Price_ShiChang")%>
                    </td>
                    <td>
                        <%#Eval("TimeID")%>
                    </td>
                    <td>
                        <%#Web.common.GetDay(Eval("StorageDate"))%>
                    </td>
                    <td>
                        <%#Eval("CurrentRate")%>
                    </td>
                    <td>
                        <%#Web.common.GetLiXi(Eval("ID"))%>
                    </td>
                    <td>
                       <a href="/User/Exchange/ExchangeGoods.aspx?Dep_SID=<%#Eval("ID") %>">兑换</a>&nbsp;
                    <a href="/User/Exchange/StoreToSell.aspx?Dep_SID=<%#Eval("ID") %>">存转销</a>&nbsp;
                       <a href="/User/Storage/StorageRenew.aspx?Dep_SID=<%#Eval("ID") %>">结息</a>
                       
                    </td>
                </tr>
            </ItemTemplate>
            <FooterTemplate>
            <tr>
            <td colspan="2">
            <span style="font-weight:bolder">折合现金合计:</span>
            </td>
            <td colspan="6" style="text-align:center">
            <span id="spanTotal" runat="server" style="color:Red; font-size:16px">￥<%=Web.common.numTotol%></span>
          
            </td>
            </tr>
                <!--底部模板-->
                </table>
                <!--表格结束部分-->
            </FooterTemplate>
        </asp:Repeater>
        </div>
        <div id="Storage" style="display:none;">
          <table class="tabData" style="margin:20px 0px;">
          <tr>
          <td colspan="6" style="font-weight:bolder; height:25px; color:Green; font-size:16px; border-bottom:1px solid #888;">存储信息</td>
          </tr>
                    <tr class="tr_head">
                        <th style="width: 200px; height:30px; text-align: center;">
                            存储产品
                        </th>
                        <th style="width: 110px; text-align: center;">
                            结存数量
                        </th>
                        <th style="width: 110px; text-align: center;">
                            存入时间
                        </th>
                        <th style="width: 110px; text-align: center;">
                            存入价
                        </th>
                        <th style="width: 110px; text-align: center;">
                            存期
                        </th>
                        <th style="width: 110px; text-align: center;">
                            天数
                        </th>
                    </tr>
                    <tr>
                     <td style="height:30px;"><span id="VarietyID" style="font-weight:bolder; color:Blue; padding:5px 0px;"></span></td>
                     <td><span id="StorageNumber" style="font-weight:bolder; color:Blue; padding:5px 0px;"></span></td>
                      <td><span id="StorageDate" style="font-weight:bolder; color:Blue; padding:5px 0px;"></span></td>
                       <td><span id="Price_ShiChang" style="font-weight:bolder; color:Blue; padding:5px 0px;"></span></td>
                        <td><span id="TimeID" style="font-weight:bolder; color:Blue; padding:5px 0px;"></span></td>
                         <td><span id="numDate" style="font-weight:bolder; color:Blue; padding:5px 0px;"></span></td>
                    </tr>
                    </table>
           
        </div>


       

        <div id="Exchange" style="display:none">
        <table style="background-color:#ececec; border:1px solid #ccc; border-radius:5px; margin:10px 0px;">
                <tr>
                <td style="padding:5px 5px;"><span>商品搜索:</span><input type="text" name="txtGoodQuery" onkeyup="Get_Good();" style="width:80px; background-color:#efefef;" /></td>
                  <td style="padding:5px 5px;"><span>选择商品:</span><select name="GoodID" style="width:100px;"></select></td>
                     <td style="padding:5px 5px;"><span>库存:</span><span id="GoodStorage" style="color:Green"></span></td>
                    <td style="padding:5px 5px;"><span>兑换数量:</span><input type="text" name="ExchangeCount" value="1" style="width:60px;" /></td>
                    
                      <td style="padding:5px 5px;"> <input type="button" name="btnAddEx" value="添加" onclick="GetChuFenLv();" class="btnOperate" style="width:80px;" /></td>
                </tr>
            </table>
            </div>
             <div id="divPolicy" style="display:none;">
          <table class="tabData" style="margin:20px 0px;">
          <tr>
          <td  style="font-weight:bolder; height:25px; color:Green; font-size:16px; border-bottom:1px solid #888;">兑换政策</td>
          </tr>
                    <tr class="tr_head">
                     <td><span id="spanPolicy" style="color:Red;"></span></td>
                    </tr>
                    </table>
           
        </div>
              <div id="ExchangeInfo" style="display:none;">
              </div>
         <div id="ExchangeOperate" style="display:none;">
         
            <input type="button" id="btnChongLai" value="清除重来" style="width:80px;" />&nbsp;
             <input type="button" id="btnJieZhang" value="结账" onclick="InitBusinessNO();" style="width:80px; font-size:18px; font-weight:bolder; color:Blue; border:1px solid #888;" />&nbsp;
                <input type="button" id="btnPrint" value="打印存折"  onclick=" PrintCunZhe();" disabled="disabled" style="width:80px;" />&nbsp;
                 <input type="button" id="btnPrintFanYe" value="翻页打印"  onclick=" PrintCunZheFanYe();"  style="width:80px; display:none;" />&nbsp;
                 <input type="button" id="btnPrintPage" value="打印小票"  onclick=" PrintPage();" disabled="disabled" style="width:80px;" />&nbsp;
        </div>
    </div>
    
    <div></div>

  <div  style="display:none;">
    <%--业务编号--%>
      <input type="text"  name="BusinessNO" value="" />
      <%--选择兑换的存储产品信息--%>
     <input type="text" name="txtDep_SID" value="" />
     <%--选择兑换商品数量--%>
     <input type="text" name="txtGoodCount" value="0" />
     <%--选择兑换商品单价--%>
     <input type="text" name="txtGoodPrice" value="0" />
<input type="text" name="txtGoodJinE" value="0" />
     
     <%--折合产品利息--%>
     <input type="text" name="txtVarietyInterest" value="0" />
 
     <%--优惠金额--%>
     <input type="text" name="txtMoney_YouHui" value="0" />

     <%--当前产品的结存数量--%>
     <input type="text" name="txtJieCun_Now" value="" />
      <%--当前产品的原始结存数量--%>
     <input type="text" name="txtJieCun_Raw" value="" />
     
    <input type="text" name="txtTimeID" value="" />
     <%--存储产品ID--%>
    <input type="text"  name="txtVarietyID" value="" />
    <%--存储产品的计价单位--%>
    <input type="text"  name="txtVarietyUnitName" value="" />
    <%--折合产品数量--%>
     <input type="text" name="txtVarietyCount" value="0" />
     <input type="text"  name="txtVarietyPrice" value="" />
      <input type="text"  name="txtVarietyName" value="" />

      <%--已经兑换的原粮数量--%>
      <input type="text"  name="txtExchange_trading" value="0" />
    </div>
    </form>
    
    <%--定义编号--%>
    <input type="hidden" id="WBID" value="" />
    <%--定义背景色的隐藏域--%>
    <input type="hidden" id="colorName" value="" />
</body>
</html>
